package org.jeecg.modules.xindian.reconciliation.mapper;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.xindian.reconciliation.controller.req.SalesManStaticUpdate;
import org.jeecg.modules.xindian.reconciliation.dto.rsp.DataSumStatisticsRow;
import org.jeecg.modules.xindian.reconciliation.dto.rsp.PlatformCodeSumStatisticsRow;
import org.jeecg.modules.xindian.reconciliation.dto.rsp.ProjectSumStatisticsRow;
import org.jeecg.modules.xindian.reconciliation.controller.req.TrendReqInfo;
import org.jeecg.modules.xindian.reconciliation.controller.rsp.CommonDataStatic;
import org.jeecg.modules.xindian.reconciliation.controller.rsp.TrendInfo;
import org.jeecg.modules.xindian.reconciliation.dto.StatisticsQuery;
import org.jeecg.modules.xindian.reconciliation.dto.TrendDto;
import org.jeecg.modules.xindian.reconciliation.entity.InsuranceStatistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: insurance_statistics
 * @Author: jeecg-boot
 * @Date:   2023-07-22
 * @Version: V1.0
 */
public interface InsuranceStatisticsMapper extends BaseMapper<InsuranceStatistics> {

    List<InsuranceStatistics> loadData(@Param("date") Date date);
    Integer  queryInsuranceTotal(@Param("query") StatisticsQuery dataStatistics);
    BigDecimal queryPremiumTotal(@Param("query")  StatisticsQuery dataStatistics);
    Integer  querySurrenderTotal(@Param("query") StatisticsQuery dataStatistics);
    BigDecimal  querySurrenderPremiumTotal(@Param("query") StatisticsQuery dataStatistics);
    IPage<DataSumStatisticsRow> queryDataSumStatisticsRow(Page page, @Param("query") StatisticsQuery dataStatistics);
    List<DataSumStatisticsRow> queryDataSumStatisticsRowAll(@Param("query") StatisticsQuery dataStatistics);
    IPage<ProjectSumStatisticsRow> queryProjectSumStatisticsRow(Page page, @Param("query") StatisticsQuery dataStatistics);
    List<ProjectSumStatisticsRow> queryProjectSumStatisticsRowAll(@Param("query") StatisticsQuery dataStatistics);


    IPage<PlatformCodeSumStatisticsRow> queryInsuranceSumStatisticsRow(Page page, @Param("query") StatisticsQuery dataStatistics);
    List<PlatformCodeSumStatisticsRow> queryInsuranceSumStatisticsRowAll(@Param("query") StatisticsQuery dataStatistics);

    /**
     * 统计数据
     */
    TrendDto trend(@Param("tr") TrendReqInfo trendReqInfo,@Param("type")String type);
    List<TrendInfo> trendAmt(TrendReqInfo trendReqInfo);
    List<TrendInfo> trendNumber(TrendReqInfo trendReqInfo);
    List<CommonDataStatic> queryAreaRank(TrendReqInfo trendReqInfo);
    List<CommonDataStatic> queryPlankRank(TrendReqInfo trendReqInfo);

    List<CommonDataStatic> queryChannelRank(TrendReqInfo trendReqInfo);
    List<CommonDataStatic> querySalesmanNameRank(TrendReqInfo trendReqInfo);
    List<CommonDataStatic> typePremium(TrendReqInfo trendReqInfo);


    Integer updateSalesmanNameAndId(SalesManStaticUpdate update);
    Integer cleanSalesmanNameAndId();
    Integer reconciliationDataProcess();

}
